package com.rykj.qxj.server.services.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rykj.qxj.server.dao.ApiOperationRecordMapper;
import com.rykj.qxj.server.model.entity.ApiManage;
import com.rykj.qxj.server.model.entity.ApiOperationRecord;
import com.rykj.qxj.server.services.IApiOperationRecordService;

@Service
public class ApiOperationRecordServiceImpl implements IApiOperationRecordService{
	
	@Autowired
	private ApiOperationRecordMapper apiOperationRecordMapper;
	
	public void saveApiOperationRecord(ApiOperationRecord apiOperationRecord) {
		apiOperationRecordMapper.insert(apiOperationRecord);
		
	}

	public PageInfo selectPageBySearchParams(Integer pageNum, Integer pageSize, String changeType,
			String apiVerifyStatus,Integer apiId) {
		    PageHelper.startPage(pageNum, pageSize);
	        Map<String,Object> paraMap = new HashMap<>();
	        paraMap.put("changeType",changeType);
	        paraMap.put("apiVerifyStatus",apiVerifyStatus);
	        paraMap.put("apiId", apiId);
	        List<ApiManage> apiManageList = apiOperationRecordMapper.selectListBySearchParams(paraMap);
	        PageInfo pageInfo=new PageInfo(apiManageList);
	        return  pageInfo;
	}
	public ApiOperationRecord selectByPrimaryKey(Integer id) {
		return apiOperationRecordMapper.selectByPrimaryKey(id);
	}
}
